From 7dd6000671ca38e0d31f07e2d09c59e0241287c8 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Tue, 13 May 2014 22:53:56 +0100 Subject: [PATCH] libxl_internal.h: introduce libxl__json_object_is_{null, number, double} ... which return true if json object is valid and of type JSON_{NULL,NUMBER,DOUBLE}. Signed-off-by: Wei Liu Acked-by: Ian Campbell --- tools/libxl/libxl_internal.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 890678743d..325d340774 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1647,6 +1647,10 @@ typedef struct { typedef struct libxl__yajl_ctx libxl__yajl_ctx; +static inline bool libxl__json_object_is_null(const libxl__json_object *o) +{ + return o != NULL && o->type == JSON_NULL; +} static inline bool libxl__json_object_is_bool(const libxl__json_object *o) { return o != NULL && o->type == JSON_BOOL; @@ -1659,6 +1663,14 @@ static inline bool libxl__json_object_is_integer(const libxl__json_object *o) { return o != NULL && o->type == JSON_INTEGER; } +static inline bool libxl__json_object_is_double(const libxl__json_object *o) +{ + return o != NULL && o->type == JSON_DOUBLE; +} +static inline bool libxl__json_object_is_number(const libxl__json_object *o) +{ + return o != NULL && o->type == JSON_NUMBER; +} static inline bool libxl__json_object_is_map(const libxl__json_object *o) { return o != NULL && o->type == JSON_MAP; -- 2.30.2